package homework;

import org.junit.Test;

import java.util.Objects;

public class Card {

    private int rank;
    private int suit;
    public static final int RANK_3 = 0;
    public static final int RANK_4 = 1;
    public static final int RANK_5 = 2;
    public static final int RANK_6 = 3;
    public static final int RANK_7 = 4;
    public static final int RANK_8 = 5;
    public static final int RANK_9 = 6;
    public static final int RANK_10 = 7;
    public static final int RANK_j = 8;
    public static final int RANK_Q = 9;
    public static final int RANK_K = 10;
    public static final int RANK_A = 11;
    public static final int RANK_2 = 12;
    public static final int RANK_joker = 13;
    public static final int RANK_joker_2 = 14;

    public static final int SUIT_HEITAO = 0;
    public static final int SUIT_HONGTAO = 1;
    public static final int SUIT_MEITUAN = 2;
    public static final int SUIT_FANGKUAI = 3;
    public static final int SUIT_NULL = 4;

    private static final String[] RANKS = {"3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K", "A", "2", "小王", "大王"};
    private static final String[] SUITS = {"♠", "♥", "♣", "♦", ""};


    @Override
    public String toString() {
        return SUITS[this.suit] + RANKS[this.rank];
    }

    @Override
    public boolean equals(Object o) {
        if (!(o instanceof Card card)) return false;
        return rank == card.rank && suit == card.suit;
    }

    @Override
    public int hashCode() {
        return Objects.hash(rank, suit);
    }

    public Card() {

    }

    public Card(int suit, int rank) {
        this.rank = rank;
        this.suit = suit;
    }

    public int getRank() {
        return rank;
    }

    public void setRank(int rank) {
        this.rank = rank;
    }

    public int getSuit() {
        return suit;
    }

    public void setSuit(int suit) {
        this.suit = suit;
    }
}




